package com.dt76.smallloanbackendservice.service.lhuaw.impl;

import com.dt76.smallloanbackendservice.mapper.lhuaw.ApplicationMapper;
import com.dt76.smallloanbackendservice.pojo.lhuaw.Application;
import com.dt76.smallloanbackendservice.service.lhuaw.ApplicationService;
import com.dt76.smallloanbackendservice.utils.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ApplicationServiceImpl implements ApplicationService {

    @Autowired
    private ApplicationMapper applicationMapper;

    @Override
    public List<Application> qryAllApplication() {
        return applicationMapper.qryAllApplication();
    }

    @Override
    public Page getApplicationAll(int pageIndex) {
        Page page = new Page();
        page.setPageIndex(pageIndex);
        page.setTotalCount(applicationMapper.qryConditionCount());
        List<Application> applicationList = applicationMapper.getApplicationAll((page.getPageIndex() - 1) * page.getPageSize(),
                page.getPageSize());
        page.setRows(applicationList);
        return page;
    }

    @Override
    public void deleteStation(int numId) {
        applicationMapper.deleteStation(numId);
    }

}
